package cn.moondev.game.entity;

/**
 * 细胞
 * @author scchen
 * @date   2015年11月17日
 */
public class Cell {

    /**
     * 细胞的状态
     */
    private State state;
    
    /**
     * 周围存活的邻居数量
     */
    private int aliveNeighborNum;
    
    /**
     * 增加一个存活邻居数量
     */
    public void plusAliveNeighborNum() {
        this.aliveNeighborNum++;
    }
    
    /**
     * 打印细胞
     */
    public void print() {
        if(getState() == State.ALIVE){
            System.out.print("■");
        }else{
            System.out.print("□");
        }
    }
    
    public Cell() {
        this.state = State.DEATH;
        this.aliveNeighborNum = 0;
    }

    public State getState() {
        return state;
    }

    public void setState(State state) {
        this.state = state;
    }

    public int getAliveNeighborNum() {
        return aliveNeighborNum;
    }

    public void setAliveNeighborNum(int aliveNeighborNum) {
        this.aliveNeighborNum = aliveNeighborNum;
    }
}